<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
    <head>
        <title></title>
        <meta charset="utf-8">
        <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
        <meta http-equiv="Access-Control-Allow-Origin" content="*">
        <link rel="stylesheet" href="css/ui-btn.css">
        <link rel="stylesheet" href="css/ui-img.css">
        <link rel="stylesheet" href="css/ui-res.css">
        <link rel="stylesheet" href="css/ui-list.css">
        <link rel="stylesheet" href="css/ui-base.css">
        <link rel="stylesheet" href="css/ui-box.css">
        <link rel="stylesheet" href="css/ui-color.css">
        <script src="js/zy/zy_control.js">
        </script>
        <script src="js/zy/zy_click.js">
        </script>
        <script src="js/common/system_config.js">
        </script>
        <script src="js/common/jquery-1.7.min.js">
        </script>
        <script>
            function toDetail(disId){
                localStorage["nowDisId"] = disId;
                uexWindow.open('detail', '0', 'detail.html', '1', '', '', '0');
            }
        </script>
    </head>
    <body class="um-vp" ontouchstart>
        <!--列表开始-->
        <div class="uc-a " id="discountList">
        </div>
        <!--列表结束-->
    </body>
    <script>
        var jApp = $.noConflict(true);
        zy_init();
        window.uexOnload = function(type){
            if (!type) {
                init();
                uexWindow.setBounce("1");
                uexWindow.showBounceView("0", "#FFF", "0");
                uexWindow.showBounceView("1", "#FFF", "0");
            }
            function init(){
                var type = localStorage["type"];
                uexWindow.toast(1, 5, '正在获取信息列表...', 0);
                var getDiscountsUrl = SysConfig.serverPath + 'discountsJson/queryListDiscounts.action?' +
                'discounts.type=' +
                type +
                '&start=' +
                0 +
                '&limit=' +
                10;
                //                var params = [{
                //                    "key": "discounts.type",
                //                    "type": "0",
                //                    "value":type
                //                }, {
                //                    "key": "start",
                //                    "type": "0",
                //                    "value": "0"
                //                }, {
                //                    "key": "limit",
                //                    "type": "0",
                //                    "value": "10"
                //                }];
                jApp.getJSON(getDiscountsUrl, getDiscountsSuccess, 'json', function(err){
                    alert(err);
                }, 'POST', false);
            }
            
            function getDiscountsSuccess(data){
                if (data[0].responseState == 1) {
                    uexWindow.alert('错误', data[0].responsePrompt, '确定');
                }
                if (data[0].responseData.length == 0) {
                    uexWindow.alert('信息', '没有数据...', '确定');
                }
                createList(data[0].responseData);
                uexWindow.closeToast();
            }
            function createList(discountsList){
                for (var i = 0; i < discountsList.length; i++) {
                    var discounts = discountsList[i];
                    var tempDom = '<ul ontouchstart="zy_touch(btn-act)" class="uc-t c-m2 ubb ub b-gra t-bla ub-ac lis" onclick=toDetail("' + discounts.id + '")>';
                    if (discounts.shopImg != "") 
                        tempDom += '<li class="lis-th ub-img"> <img src=' + discounts.shopImgSrc + ' /></li>';
                    else 
                        tempDom += '<li class="lis-th ub-img noPic"></li>';
                    tempDom += '<ul class="ub-f1 ub ub-ver">' +
                    '<li class="ulev1">' +
                    discounts.goods +
                    '</li>' +
                    '<li class="ulev-1 umh4 t-blu">' +
                    discounts.disp +
                    '</li>' +
                    '<ul class="ub ub-ac t-b ulev-2">' +
                    '<li class="umh2 umw2 ub-img ulev">被赞次数：</li>' +
                    '<li class="ub-f1 t-org ulev2">' +
                    discounts.approval +
                    '</li>' +
                    '<li class="umh2 umw2 ub-img ulev">折扣：</li>' +
                    '<li class="ub-f1 t-org ulev2">' +
                    discounts.discount +
                    '折</li>' +
                    '</ul></ul></ul>';
                    jApp("#discountList").append(tempDom);
                }
            }
        }
    </script>
</html>
